﻿<%
        int ProductID = int.Parse(Request.QueryString["ProductID"].ToString());
        dt = new BUS.ProductsBUS().GetProductByID(ProductID);
        txt_Product.Text = dt.Rows[0]["ProductName"].ToString();
        txt_Unit.Text = dt.Rows[0]["QuantityPerUnit"].ToString();
        txt_Price.Text = dt.Rows[0]["UnitPrice"].ToString();
        txt_Discount.Text = dt.Rows[0]["Discount"].ToString();
        CKEditor1.Text = dt.Rows[0]["Description"].ToString();
        sbCategories.SelectedValue = dt.Rows[0]["CategoryID"].ToString();
        HiddenFieldProductID.Value = dt.Rows[0]["ProductID"].ToString();     
%>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UpdateProduct.aspx.cs" Inherits="Website.UpdateProduct" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="Scripts/jquery.validate.js" type="text/javascript"></script>
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
	<script src="ckeditor/_samples/sample.js" type="text/javascript"></script>
	<link href="ckeditor/_samples/sample.css" rel="stylesheet" type="text/css" />
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 100%;
            border-left: 1px solid #808080;
            border-right-style: solid;
            border-right-width: 1px;
            border-top: 1px solid #808080;
            border-bottom-style: solid;
            border-bottom-width: 1px;
        }
        .style2
        {
            width: 255px;
        }
        .error
        {
        	color:Red;
        	font-weight:bold;
        }
    </style>
</head>
<body>

    <form id="formUpdateProduct" runat="server">
    <div>
    
        <table class="style1">
            <tr>
                <td class="style2">
                    Tên sản phẩm</td>
                <td>
                    <asp:TextBox ID="txt_Product" runat="server" CssClass="required"></asp:TextBox>
                    <asp:HiddenField ID="HiddenFieldProductID" runat="server" />
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Loại sản phẩm</td>
                <td>
                    <asp:DropDownList ID="sbCategories" runat="server" 
                        DataSourceID="ObjectDataSource1" DataTextField="CategoryName" 
                        DataValueField="CategoryID">
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                        SelectMethod="GetList" TypeName="BUS.CategoriesBUS"></asp:ObjectDataSource>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Đơn vị tính</td>
                <td>
                    <asp:TextBox ID="txt_Unit" runat="server" CssClass="required"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Đơn giá</td>
                <td>
                    <asp:TextBox ID="txt_Price" runat="server" CssClass="required"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Hình ảnh</td>
                <td>
                    <asp:FileUpload ID="FileUploadImage" runat="server"/>
                   
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Mô tả</td>
                <td>
                 <CKEditor:CKEditorControl class="required" ID="CKEditor1" name="CKEditor1" 
                        runat="server" CssClass="required"></CKEditor:CKEditorControl>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Số lượng</td>
                <td>
                    <asp:TextBox ID="txt_Discount" runat="server" CssClass="required"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    &nbsp;</td>
                <td>
                    <asp:Button ID="ButtonHuy" runat="server" Text="Hủy" />
                    <asp:Button ID="ButtonSua" runat="server" Text="Cập nhật" onclick="ButtonSua_Click" 
                    />
                </td>
            </tr>
            <tr>
                <td colspan="2" class="style2">
                     <asp:Label ID="StatusLabel" runat="server" Text=""></asp:Label>
                </td>
                
            </tr>
            
        </table>
    
    </div>
    
    <script>
        $().ready(function () {
            $('#formUpdateProduct').validate();

        });
    </script>
    </form>
    
    </body>
</html>

